package com.company.test.proxy;

import java.lang.reflect.Proxy;

/**
 * @author zhangyan
 * @version $ Id: MapperProxyFactory.java, v 0.1 2020/9/15 19:44 zhangyan Exp $
 */
public class MapperProxyFactory<T> {
    private final Class<T> mapperInterface;

    public MapperProxyFactory(Class<T> mapperInterface) {
        this.mapperInterface = mapperInterface;
    }

    protected T newInstance(MapperProxy<T> mapperProxy) {
        return (T) Proxy.newProxyInstance(mapperInterface.getClassLoader(), new Class[]{mapperInterface}, mapperProxy);
    }
}
